package com.axzhengxin.platform.business.controller;

import com.axzhengxin.platform.afterloan.domain.FspCorInf;
import com.axzhengxin.platform.business.domain.BizFactoringInfo;
import com.axzhengxin.platform.business.domain.BizInsuranceInfo;
import com.axzhengxin.platform.business.service.IBizFactoringInfoService;
import com.axzhengxin.platform.business.service.IBizInsuranceInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author AHZJ0005
 */
@RestController
@RequestMapping("/biz/factoring")
public class BizFactoringController extends BaseController {

    @Autowired
    private IBizFactoringInfoService bizFactoringService;
    @Autowired
    private IBizInsuranceInfoService bizInsuranceInfoService;


    @RequestMapping("/list")
    public TableDataInfo list(BizFactoringInfo bizFactoringInfo) {
        startPage();
        return getDataTable(bizFactoringService.selectBizFactoringInfoList(bizFactoringInfo));
    }

    @RequestMapping("/detail")
    public BizFactoringInfo detail(String factoringId) {
        BizFactoringInfo bizFactoringInfo = bizFactoringService.selectBizFactoringInfoById(factoringId);
        String customerId = bizFactoringInfo.getCustomerId();
        String customerName = bizFactoringInfo.getCustomerName();
        FspCorInf fspCorInf = bizInsuranceInfoService.getFspCorInf(customerId, customerName);
        bizFactoringInfo.setFspCorInf(fspCorInf);
        return bizFactoringInfo;
    }

}
